public without sharing class MeasureCalcProductHandler {
 
    
    public static void setOppProjectType(List<Measure_Calculate_Product__c> newList) {

        Set<Id> oidSet = new Set<Id>();
        Set<Id> mcidSet = new Set<Id>();
        //Set<Id> qtidSet = new Set<Id>();
        //Set<String> mcpc1Set = new Set<String>();

        //取得测算信息ID
        for ( Measure_Calculate_Product__c mcp : newList ) {
            mcidSet.add(mcp.Measure_Calculate__c);            
        }
        System.debug('================'+mcidSet);
    
        //取得业务机会ID
        for ( Measure_Calculate__c mc : [SELECT Id,Opportunity__c,Status__c FROM Measure_Calculate__c WHERE Id IN :mcidSet] ) {
            if(mc.Status__c == '已提交' || mc.Status__c == '审批成功' )oidSet.add(mc.Opportunity__c);
        }
            System.debug('================'+oidSet);
        if (oidSet.size() > 0) OppSetProjectTypeHandler.calcOppSetProjectType(oidSet);
 
        
     /*
        //查询相关客户下的客户等级
        Map<Id, Opportunity> oppMap = new Map<Id, Opportunity>([SELECT Id, AccountId, Account.Level__c FROM Opportunity WHERE Id IN :oidSet]);
        //查询测算信息产品下的一级分类：mcplist
        Map<Id, List<Measure_Calculate_Product__c>> mcpMap = new Map<Id, List<Measure_Calculate_Product__c>>();

        for ( Measure_Calculate_Product__c mcp : [ SELECT Id, Product__r.Category1__c, Measure_Calculate__c, Measure_Calculate__r.Opportunity__c
                 FROM Measure_Calculate_Product__c WHERE Measure_Calculate__r.Opportunity__c IN :oidSet] ) {
            List<Measure_Calculate_Product__c> mcplist = new List<Measure_Calculate_Product__c>();
            Id oid = mcp.Measure_Calculate__r.Opportunity__c;            
            if ( mcpMap.containsKey(oid)  == true ) {
                mcplist = mcpMap.get(oid);
            }
            mcplist.add(mcp);            
            mcpMap.put(oid, mcplist);
        }       

        List<Opportunity> oppList = new List<Opportunity>(); 
        for ( Id oid : oidSet ) {
  
            Opportunity opp = new Opportunity(Id = oid);
           
            String level = String.valueOf(oppMap.get(oid).Account.Level__c);
            List<Measure_Calculate_Product__c> mcplist = mcpMap.get(oid);
            //List<QuoteProduct__c> qplist = qpMap.get(oid);
 
            if ( mcplist != null ) {
                for (Measure_Calculate_Product__c mcp : mcplist ) {
                    mcpc1Set.add(mcp.Product__r.Category1__c); 
                    System.debug('============='+mcp.Product__r.Category1__c);
                }
            }
         
            opp.ProjectType__c  = IPQPMECPHandler.calcOppProjectType(level, mcpc1Set);            
            oppList.add(opp);                 
                
        }
        update oppList;*/
    }
}